const request = axios.create({
	baseURL: process.env.BASE_API,
	timeout: 5000
})

request.interceptors.response.use(
	response => {
		const res = response.data
		if(res.error!==0){
			return Promise.reject('error')
		}else{
			return response.data
		}
	},
	
	error => {
		console.log('err' + error) // for debug
		ELEMENT.Message({
			message: error.message,
			type: 'error',
			duration: 5 * 1000
		})
		return Promise.reject(error)
	}
)
export default request